<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       let a = "第1章对JavaScript进行了概述性的介绍,从本章开始将对JavaScript进行深入讨论,并分析JavaScript的核心ECMAScript,让读者从底层了解JavaScript,如JavaScript的基本语法、变量、关键字、保留字、语句、函数等。";
       let count = 0;
        for (let i = 0; i < a.length; i++) {
            if (a.indexOf("JavaScript", i) !== -1) {
                count++;
                i = a.indexOf("JavaScript", i);
            }
        }
        document.write("JavaScript出现的次数是:" + count + "次");
    </script>
</head>
<body>

</body>
</html>